package exercise;

import java.util.HashSet;
import java.util.Set;

public class NC_ {
    public static void main(String[] args) {
        String s1 = "hfk92e.kjhg";
        String s2 = "hf9e.hg";
        Set<Character> set = func(s1,s2);
        System.out.println(set);
    }
    public static Set<Character> func(String s1, String s2){
        Set<Character> set = new HashSet<>();
        Set<Character> set1 = new HashSet<>();
        for (int i = 0; i < s2.length(); i++) {  //可先转成大写再转成字符数组
            set.add(s2.charAt(i));
        }
        for (int i = 0; i < s1.length(); i++) {
            char c = s1.charAt(i);
            if(!set.contains(c)){
                if(c >= 'a' && c <= 'z'){
                    c -= 32;
                }
                set1.add(c);
            }
        }
        return set1;
    }
}
